Fedora 18
Sponsored Link

Add Hard Drives
2013/01/18
 
This is an example to create a new partition when you add new Hard Drives on your Machine.
The follows shows to create a LVM partition.
[root@dlp ~]#
fdisk /dev/sdb
# enter to the fdisk operation mode
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
  switch off the mode (command 'c') and change display units to

  sectors (command 'u').
Command (m for help):
p
# show partition table
Disk /dev/sdb: 320.1 GB, 320071851520 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c881d
  Device Boot
Start
End
Blocks
Id
System

 
# none

Command (m for help):
n
# create a partition

Command action
  e    extended
  p    primary partition (1-4)
p
# primary

Partition number (1-4):
1
# partition number

First cylinder (1-1-38913, default 1):
# starting cylinder

Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-38913, default 38913): 
# end cylinder

Using default value 38913
Command (m for help):
p
# show partition table
Disk /dev/sdb: 320.1 GB, 320071851520 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c881d
  Device Boot
Start
End
Blocks
Id
System

  /dev/sdb1
1
38913
312568641
83
Linux  
# just created
Command (m for help):
t
# change type

Selected partition 1
Hex code (type L to list codes):
L
# show lists

 0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris
 1  FAT12           27  Hidden NTFS Win 82  Linux swap / So c1  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  84  OS/2 hidden C:  c6  DRDOS/sec (FAT-
 4  FAT16 <32m 40="" venix="" 80286="" 85="" linux="" extended="" c7="" syrinx="" 5="" extended="" 41="" ppc="" prep="" boot="" 86="" ntfs="" volume="" set="" da="" non-fs="" data="" 6="" fat16="" 42="" sfs="" 87="" ntfs="" volume="" set="" db="" cp/m="" ctos="" .="" 7="" hpfs/ntfs/exfat="" 4d="" qnx4.x="" 88="" linux="" plaintext="" de="" dell="" utility="" 8="" aix="" 4e="" qnx4.x="" 2nd="" part="" 8e="" linux="" lvm="" df="" bootit="" 9="" aix="" bootable="" 4f="" qnx4.x="" 3rd="" part="" 93="" amoeba="" e1="" dos="" access="" a="" os/2="" boot="" manag="" 50="" ontrack="" dm="" 94="" amoeba="" bbt="" e3="" dos="" r/o="" b="" w95="" fat32="" 51="" ontrack="" dm6="" aux="" 9f="" bsd/os="" e4="" speedstor="" c="" w95="" fat32="" (lba)="" 52="" cp/m="" a0="" ibm="" thinkpad="" hi="" eb="" beos="" fs="" e="" w95="" fat16="" (lba)="" 53="" ontrack="" dm6="" aux="" a5="" freebsd="" ee="" gpt="" f="" w95="" ext'd="" (lba)="" 54="" ontrackdm6="" a6="" openbsd="" ef="" efi="" (fat-12/16/="" 10="" opus="" 55="" ez-drive="" a7="" nextstep="" f0="" linux/pa-risc="" b="" 11="" hidden="" fat12="" 56="" golden="" bow="" a8="" darwin="" ufs="" f1="" speedstor="" 12="" compaq="" diagnost="" 5c="" priam="" edisk="" a9="" netbsd="" f4="" speedstor="" 14="" hidden="" fat16=""><3 61="" speedstor="" ab="" darwin="" boot="" f2="" dos="" secondary="" 16="" hidden="" fat16="" 63="" gnu="" hurd="" or="" sys="" af="" hfs="" hfs+="" fb="" vmware="" vmfs="" 17="" hidden="" hpfs/ntf="" 64="" novell="" netware="" b7="" bsdi="" fs="" fc="" vmware="" vmkcore="" 18="" ast="" smartsleep="" 65="" novell="" netware="" b8="" bsdi="" swap="" fd="" linux="" raid="" auto="" 1b="" hidden="" w95="" fat3="" 70="" disksecure="" mult="" bb="" boot="" wizard="" hid="" fe="" lanstep="" 1c="" hidden="" w95="" fat3="" 75="" pc/ix="" be="" solaris="" boot="" ff="" bbt="" 1e="" hidden="" w95="" fat1="" 80="" old="" minix="">
Hex code (type L to list codes):
8e
 
# select Linux LVM number

Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help):
p
# show partition table
Disk /dev/sdb: 320.1 GB, 320071851520 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c881d
  Device Boot
Start
End
Blocks
Id
System

  /dev/sdb1
1
38913
312568641
8e
Linux LVM  
# just changed
Command (m for help):
w
# save and quit

The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@dlp ~]#
sfdisk -l /dev/sdb
# show status
Disk /dev/sdb: 38913 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
Device
  Boot
Start
End
#cyls
#blocks
Id
System

/dev/sdb1
0+
20022
38913-
312568641
8e
Linux LVM  
# just changed

/dev/sdb2
0
-
0
0
0
Empty

/dev/sdb3
0
-
0
0
0
Empty

/dev/sdb4
0
-
0
0
0
Empty

 
Tweet